#!/bin/bash

if [ "$(whoami)" != "root" ]; then
    echo "Script must be run as root, e.g."
    echo sudo $0
    exit 1
fi

cp "48.png" "/usr/share/icons/Deepin/apps/48/sublime_text.png"

for SIZE in 256 128 48 32 16
do
    ICON_SIZE_DIRECTORY="/usr/share/sublime-text/Icon/${SIZE}x${SIZE}"
    cp "${SIZE}.png" "${ICON_SIZE_DIRECTORY}/sublime_text.png"
done

sudo find /usr/share/icons -mindepth 1 -maxdepth 1 -type d | while read -r THEME; do
  if [ -f "$THEME/index.theme" ]; then
    sudo gtk-update-icon-cache -f -q "$THEME"
  fi
done
